<template>
  <t-dialog :header="`${header}`" :visible.sync="visible" :onClose="closeDialog" :closeOnOverlayClick="false"
    width="60%" top="5%">
    <div style="height: 65vh">
      <t-table row-key="id" :columns="columns" :loading="dataLoading" :data="dataList">
        <template #id="{ row, rowIndex }">
          {{ rowIndex + 1 }}
        </template>
        <template #classification="{ row }">
          {{ row.classification | filterByDict(dict.type.classification) }}
        </template>
        <template #[`reviewTeam.reviewType`]="{ row }">
          {{ row.reviewTeam?.reviewType | filterByDict(dict.type.review_type) }}
        </template>
        <template #joinType="{ row }">
          <div v-if="row.joinType == 1" style="color: #66CC00;">
            是
          </div>
          <div v-else style="color: red;">
            否
          </div>
        </template>
      </t-table>

    </div>

  </t-dialog>
</template>

<script>

export default {
  name: "select-expert-detail",
  dicts: ['review_type'],
  components: {
  },
  props: {
    header: {
      type: String,
      default: '专家历史参与评审情况'
    },
    objId: [String, Number],
  },
  watch: {
    objId: {
      immediate: true,
      handler (val) {
        if (val) {
          this.getList();
        }
      }
    }
  },
  data () {
    return {

      dataList: [],
      dataLoading: false,

      columns: [
        {
          colKey: "id",
          title: "序号",
          align: "center",
          width: 64
        },
        {
          colKey: "reviewTeam.name",
          title: "评审组名称",
          align: "center",
        },
        {
          colKey: "reviewTeam.reviewType",
          title: "评审业务类型",
          align: "center",

        },
        {
          colKey: "reviewTeam.startReviewDate",
          title: "开始时间",
          align: "center",

        },
        {
          colKey: "reviewTeam.reviewMeetingDate",
          title: "会议时间",
          align: "center",

        },
        {
          colKey: "reviewTeam.endReviewDate",
          title: "结束时间",
          align: "center",
        },
        {
          colKey: "joinType",
          title: "是否参加",
          align: "center",
          width: 90
        },
      ],

      visible: true,
      loading: false,
    }
  },

  created () {
  },
  methods: {

    getList () {
      this.dataLoading = true;
      // this.queryParams.teamId = this.formData.id;
      this.$api.kjxm.review.getByExpertsId(this.objId).then((res) => {
        this.dataList = res.data;
        this.dataLoading = false;
      }).catch((e) => {
        this.dataLoading = false
        this.$message.error(e.toString());
      });
    },

    closeDialog () {
      this.$emit("update:visible", false);
    },

  }
}
</script>

<style scoped>
.overlay-options {
  display: inline-block;
  font-size: 20px;
}
</style>
